package se.thoka.twt.client.utils.validation;

import se.thoka.twt.client.utils.StringUtils;

/**
 * <p>
 * Asserts that the value is not <code>null</code> or empty.
 * </p>
 * 
 * @author Thobias Karlsson, Thoka
 * @since 9 jan 2010
 */
public class NotEmptyValidation implements Validation {
	
	public static NotEmptyValidation INSTANCE = new NotEmptyValidation();
	private String message;

	public NotEmptyValidation() {
		this(ValidationUtil.getStrings().notEmptyError());
	}

	public NotEmptyValidation(String message) {
		this.message = message;
	}

	@Override
	public String getDescription() {
		return message;
	}

	@Override
	public boolean validate(String value) {
		return !StringUtils.nullOrEmpty(value);
	}
}
